<?php

/**
 * Name: 员工消息模型层
 * User: Silent
 * Date: 2025-10-09
 * Time: 15:20:28
 */

namespace App\Models\Message;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class UserMessage extends Model
{
    use HasFactory, SoftDeletes;

    protected static array $ignoreChangedAttributes = [
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    protected static array $logAttributes = [

    ];

    protected static bool $logOnlyDirty = true;

    protected $table = 'user_messages';

    protected $guarded = [];

    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'deleted_at' => 'datetime:Y-m-d H:i:s',
    ];

    protected function serializeDate(DateTimeInterface $date): string
    {
        return $date->format('Y-m-d H:i:s');
    }
}
